<?php
class Questioncatch extends AppModel {
	//SELECT catchwordId, count(id) FROM `questioncatch` group by catchwordid order by catchwordId
	function getCountQuestionsByFeatureCatchwords($limit = 30){
		$query = 'SELECT questioncatches.catchwordId AS catchword_id, count(questioncatches.id)  AS num_question, catchwords.catchword
				 AS catchword_name FROM `questioncatches`,`catchwords`
				 WHERE questioncatches.catchwordId = catchwords.id';
		$query .= ' GROUP BY catchwordid ORDER BY num_question DESC LIMIT ';
		$query .= $limit;
		$countList = 
			$this->query($query);
		return $countList;
	}
}